package com.mtons.mblog.modules.service.impl;

import com.mtons.mblog.modules.entity.LearnContentType;
import com.mtons.mblog.modules.repository.LearnDocDetailRepository;
import com.mtons.mblog.modules.service.LearnDocDetailService;
import com.mtons.mblog.modules.entity.LearnDocDetail;

import java.util.*;

import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.domain.*;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
@author Tison
*/
@Service
public class LearnDocDetailServiceImpl  implements LearnDocDetailService  {

	@Resource
	private LearnDocDetailRepository rep;


	 public LearnDocDetail save(LearnDocDetail obj) {
		 return rep.save(obj);
	 }


	 @Transactional
	 public List<LearnDocDetail> saveAll(Iterable<LearnDocDetail> list) {
		 return rep.saveAll(list);
	 }


	 public LearnDocDetail getOne(String id) {
		 return rep.getOne(id);
	 }


	 public LearnDocDetail findById(String id) {
		 Optional<LearnDocDetail> obj = rep.findById(id);
		 return obj.orElse(null);
	 }


	 public void deleteById(String id) {
		 rep.deleteById(id);
	 }


	 @Transactional
	 public void deleteAll(List list) {
		 rep.deleteAll(list);
	 }


	 public void delete(LearnDocDetail obj) {
		 rep.delete(obj);
	 }


	 public boolean existsById(String id) {
		 return rep.existsById(id);
	 }


	 public long count() {
		 return rep.count();
	 }


	 public List<LearnDocDetail> findAll() {
		 return rep.findAll();
	 }


	 public List<LearnDocDetail> findAll(LearnDocDetail obj) {
		 List<LearnDocDetail> list = rep.findAll(Example.of(obj));
		 return list==null||list.size()<1?null:list;
	 }


	 public List<LearnDocDetail> findAll(Sort sort) {
		 return rep.findAll(sort);
	 }


	 public List<LearnDocDetail> findAllById(Iterable<String> ids) {
		 return rep.findAllById(ids);
	 }


	 public List<LearnDocDetail> findAll(Example<LearnDocDetail> e) {
		 return rep.findAll(e);
	 }


	 public List<LearnDocDetail> findAll(Example<LearnDocDetail> e, Sort sort) {
		 return rep.findAll(e,sort);
	 }


	 public Page<LearnDocDetail> findAll(Pageable page) {
		 return rep.findAll(page);
	 }


	 public Page<LearnDocDetail> findAll(Example<LearnDocDetail> e, Pageable page) {
		 return rep.findAll(e,page);
	 }


	 public Page<LearnDocDetail> findAll(LearnDocDetail obj, Pageable page) {
		 return rep.findAll(Example.of(obj),page);
	 }


	@Override
	public Map<String, LearnDocDetail> findMapByIds(Set<String> typeIds) {
		List<LearnDocDetail> list = rep.findAllById(typeIds);
		Map<String, LearnDocDetail> rets = new HashMap<>();
		list.forEach(po -> rets.put(po.getId(), po));
		return rets;
	}
}
